package title;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 功能：
 * 作者：lc
 * 日期：2025/1/30 0:02
 */
public class MainP1085 {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int sum=0;
        int res=1;
        for (int i = 0; i < 7; i++) {
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int num = a + b;
            if (num>sum){
                sum=num;
                res=i+1;
            }
        }
        if (sum<=8){
            System.out.println(0);
        }else {
            System.out.println(res);
        }
    }

}
